package org.framework.define.bean.result.criteria;

import java.util.ArrayList;
import java.util.List;

import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.framework.define.bean.result.criteria.Page;

import com.thoughtworks.xstream.annotations.XStreamImplicit;

@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class Data extends Page {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3827967228536008000L;
	
	@XStreamImplicit(itemFieldName="info")
	protected List<?> info;	//数据集
	
	public Data() {}
	
	public Data(Object info) {
		List<Object> list = new ArrayList<>();
		list.add(info);
		this.info = list;
	}
	
	public Data(List<?> info) {
		this.info = info;
	}
	
	public Data(List<?> info, Page page) {
		this(info);
		setPage(page);
	}
	
	public List<?> getInfo() {
		return info;
	}

	public void setInfo(List<?> info) {
		this.info = info;
	}
	
	public void setPage(Page page) {
		this.totalnum = page.getTotalnum();
		this.totalpage = page.getTotalpage();
		this.num = page.getNum();
		this.page = page.getPage();
	}
}
